// Created from GenerationTemplate
// For Decisions HL7 Engine
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
using System.Reflection;
using DecisionsFramework.Design.Properties;
using Decisions.HL7.Generated.AbstractMessage;
using Decisions.HL7.DataTypes;
using ST = System.String;
using SI = System.String;
using TX = System.String;
using FT = System.String;
using IS = System.String;
using ID = System.String;
using SNM = System.String;

namespace Decisions.HL7.Message
{
    [DataContract]
	public class CX : AbstractDataType
    {

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("1 ID",1)]
  	    [HL7Field(HL7Version.v23, 1, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v231, 1, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v24, 1, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v25, 1, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v251, 1, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v26, 1, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v27, 1, HL7Repeat.False, HL7Required.True,"ST")]
	    public ST ID {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("2 Identifier Check Digit",2)]
  	    [HL7Field(HL7Version.v23, 2, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v231, 2, HL7Repeat.False, HL7Required.True,"NM")]
  	    [HL7Field(HL7Version.v24, 2, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v25, 2, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v251, 2, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v26, 2, HL7Repeat.False, HL7Required.True,"ST")]
  	    [HL7Field(HL7Version.v27, 2, HL7Repeat.False, HL7Required.True,"ST")]
	    public ST IdentifierCheckDigit {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("3 Check Digit Scheme",3)]
  	    [HL7Field(HL7Version.v23, 3, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v231, 3, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v24, 3, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v25, 3, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v251, 3, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v26, 3, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v27, 3, HL7Repeat.False, HL7Required.True,"ID")]
		[CheckDigitScheme]
	    public ID CheckDigitScheme {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("4 Assigning Authority",4)]
  	    [HL7Field(HL7Version.v23, 4, HL7Repeat.False, HL7Required.True,"HD")]
  	    [HL7Field(HL7Version.v231, 4, HL7Repeat.False, HL7Required.True,"HD")]
  	    [HL7Field(HL7Version.v24, 4, HL7Repeat.False, HL7Required.True,"HD")]
  	    [HL7Field(HL7Version.v25, 4, HL7Repeat.False, HL7Required.True,"HD")]
  	    [HL7Field(HL7Version.v251, 4, HL7Repeat.False, HL7Required.True,"HD")]
  	    [HL7Field(HL7Version.v26, 4, HL7Repeat.False, HL7Required.True,"HD")]
  	    [HL7Field(HL7Version.v27, 4, HL7Repeat.False, HL7Required.True,"HD")]
		[AssigningAuthority]
	    public HD AssigningAuthority {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("5 Identifier Type Code",5)]
  	    [HL7Field(HL7Version.v23, 5, HL7Repeat.False, HL7Required.True,"IS")]
  	    [HL7Field(HL7Version.v231, 5, HL7Repeat.False, HL7Required.True,"IS")]
  	    [HL7Field(HL7Version.v24, 5, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v25, 5, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v251, 5, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v26, 5, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v27, 5, HL7Repeat.False, HL7Required.True,"ID")]
		[IdentifierType]
	    public ID IdentifierTypeCode {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("6 Assigning Facility",6)]
  	    [HL7Field(HL7Version.v23, 6, HL7Repeat.False, HL7Required.True,"HD")]
  	    [HL7Field(HL7Version.v231, 6, HL7Repeat.False, HL7Required.True,"HD")]
  	    [HL7Field(HL7Version.v24, 6, HL7Repeat.False, HL7Required.True,"HD")]
  	    [HL7Field(HL7Version.v25, 6, HL7Repeat.False, HL7Required.True,"HD")]
  	    [HL7Field(HL7Version.v251, 6, HL7Repeat.False, HL7Required.True,"HD")]
  	    [HL7Field(HL7Version.v26, 6, HL7Repeat.False, HL7Required.True,"HD")]
  	    [HL7Field(HL7Version.v27, 6, HL7Repeat.False, HL7Required.True,"HD")]
	    public HD AssigningFacility {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("7 Effective Date",7)]
  	    [HL7Field(HL7Version.v24, 7, HL7Repeat.False, HL7Required.True,"DT")]
  	    [HL7Field(HL7Version.v25, 7, HL7Repeat.False, HL7Required.True,"DT")]
  	    [HL7Field(HL7Version.v251, 7, HL7Repeat.False, HL7Required.True,"DT")]
  	    [HL7Field(HL7Version.v26, 7, HL7Repeat.False, HL7Required.True,"DT")]
  	    [HL7Field(HL7Version.v27, 7, HL7Repeat.False, HL7Required.True,"DT")]
	    public DT EffectiveDate {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("8 Expiration Date",8)]
  	    [HL7Field(HL7Version.v24, 8, HL7Repeat.False, HL7Required.True,"DT")]
  	    [HL7Field(HL7Version.v25, 8, HL7Repeat.False, HL7Required.True,"DT")]
  	    [HL7Field(HL7Version.v251, 8, HL7Repeat.False, HL7Required.True,"DT")]
  	    [HL7Field(HL7Version.v26, 8, HL7Repeat.False, HL7Required.True,"DT")]
  	    [HL7Field(HL7Version.v27, 8, HL7Repeat.False, HL7Required.True,"DT")]
	    public DT ExpirationDate {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("9 Assigning Jurisdiction",9)]
  	    [HL7Field(HL7Version.v25, 9, HL7Repeat.False, HL7Required.True,"CWE")]
  	    [HL7Field(HL7Version.v251, 9, HL7Repeat.False, HL7Required.True,"CWE")]
  	    [HL7Field(HL7Version.v26, 9, HL7Repeat.False, HL7Required.True,"CWE")]
  	    [HL7Field(HL7Version.v27, 9, HL7Repeat.False, HL7Required.True,"CWE")]
	    public CWE AssigningJurisdiction {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("10 Assigning Agency or Department",10)]
  	    [HL7Field(HL7Version.v25, 10, HL7Repeat.False, HL7Required.True,"CWE")]
  	    [HL7Field(HL7Version.v251, 10, HL7Repeat.False, HL7Required.True,"CWE")]
  	    [HL7Field(HL7Version.v26, 10, HL7Repeat.False, HL7Required.True,"CWE")]
  	    [HL7Field(HL7Version.v27, 10, HL7Repeat.False, HL7Required.True,"CWE")]
	    public CWE AssigningAgencyorDepartment {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("11 Security Check",11)]
  	    [HL7Field(HL7Version.v27, 11, HL7Repeat.False, HL7Required.True,"ST")]
	    public ST SecurityCheck {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("12 Security Check Scheme",12)]
  	    [HL7Field(HL7Version.v27, 12, HL7Repeat.False, HL7Required.True,"ID")]
		[SecurityCheckScheme]
	    public ID SecurityCheckScheme {get;set;}





		public override string GetER7(HL7ParserOptions options) {
			List<string> dataTypeParts = new List<string>();
		    dataTypeParts.Add(ID);
		    dataTypeParts.Add(IdentifierCheckDigit);
		    dataTypeParts.Add(CheckDigitScheme);
			dataTypeParts.Add(GetER7TextForDataPart(AssigningAuthority, options));
		    dataTypeParts.Add(IdentifierTypeCode);
			dataTypeParts.Add(GetER7TextForDataPart(AssigningFacility, options));
			dataTypeParts.Add(GetER7TextForDataPart(EffectiveDate, options));
			dataTypeParts.Add(GetER7TextForDataPart(ExpirationDate, options));
			dataTypeParts.Add(GetER7TextForDataPart(AssigningJurisdiction, options));
			dataTypeParts.Add(GetER7TextForDataPart(AssigningAgencyorDepartment, options));
		    dataTypeParts.Add(SecurityCheck);
		    dataTypeParts.Add(SecurityCheckScheme);
			return CleanUpTrailingComponentSeps(string.Join("" + options.ComponentSep, dataTypeParts.ToArray()), options);
		}
    }
}

